﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UserInterface.ClientApplication
{
	public partial class ClientFormGridArea : BaseFormGridArea
	{
		public ClientFormGridArea()
		{
			InitializeComponent();
		}

		private void ClientFormGridArea_Load(object sender, EventArgs e)
		{
			InfoLabel.Text = "Список контрагентов";
			this.Text = "Контрагенты";
			BaseGridView.AutoGenerateColumns = false;

			DataGridViewTextBoxColumn NameColumn = new DataGridViewTextBoxColumn();
			NameColumn.DataPropertyName = "Name";
			NameColumn.HeaderText = "ФИО / Название";
			NameColumn.Width = 120;
			DataGridViewTextBoxColumn AddressColumn = new DataGridViewTextBoxColumn();
			AddressColumn.DataPropertyName = "Address";
			AddressColumn.HeaderText = "Адрес";
			DataGridViewTextBoxColumn EmailColumn = new DataGridViewTextBoxColumn();
			EmailColumn.DataPropertyName = "Email";
			EmailColumn.HeaderText = "E-mail";
			DataGridViewTextBoxColumn PhoneColumn = new DataGridViewTextBoxColumn();
			PhoneColumn.DataPropertyName = "Phone";
			PhoneColumn.HeaderText = "Телефон";
			DataGridViewTextBoxColumn FaxColumn = new DataGridViewTextBoxColumn();
			FaxColumn.DataPropertyName = "Fax";
			FaxColumn.HeaderText = "Факс";
			DataGridViewTextBoxColumn UNPColumn = new DataGridViewTextBoxColumn();
			UNPColumn.DataPropertyName = "UNP";
			UNPColumn.HeaderText = "УНП";


			BaseGridView.Columns.Add(NameColumn);
			BaseGridView.Columns.Add(AddressColumn);
			BaseGridView.Columns.Add(EmailColumn);
			BaseGridView.Columns.Add(PhoneColumn);
			BaseGridView.Columns.Add(FaxColumn);
			BaseGridView.Columns.Add(UNPColumn);

			BaseGridView.DataSource = fm.GetAllClient();

			// Это топорно, но я не понимаю, почему без этого не хочет нормально
			// работать, так что оставляем так)))
			Width = 650;
			Height = 350;

			grbMain.Width = 622;
			grbMain.Height = 247;

			AddButton.Location = new Point(397, 261);
			EditButton.Location = new Point(448, 261);
			DeleteButton.Location = new Point(499, 261);
			CloseButton.Location = new Point(582, 261);
		}
	}
}
